'''
Created on 2009-4-17

@author: Administrator
'''
import unittest
from com.carnation.common.util.test import testTools


class Test(unittest.TestCase):
    def testGetChildNodes(self):
        test = testTools(__file__) 
        rsp_msg = test.requestAndRsp(1, 'Run For Test DataService.getChildNodes', \
'''
DataService.getChildNodes
    String    "Catalog=1"
''', \
'''
List
    0
        MOINode
            getId    "Schema=1"
            getName    "schema0"
    1
        MOINode
            getId    "Schema=2"
            getName    "schema1"
    2
        MOINode
            getId    "Schema=3"
            getName    "schema2"
'''
)
        print rsp_msg
        rsp_msg = test.requestAndRsp(2, 'Run For Test DataService.getChildNodes', \
'''
DataService.getChildNodes
    String    "Catalog=1"
    int    0
    int    3
''', \
'''
List
    0
        MOINode
            getId    "Schema=1"
            getName    "schema0"
    1
        MOINode
            getId    "Schema=2"
            getName    "schema1"
    2
        MOINode
            getId    "Schema=3"
            getName    "schema2"
'''
)
        print rsp_msg
        print '\nDone'
        test.quit()

    def testGetChildren(self):
        test = testTools(__file__) 
        rsp_msg = test.requestAndRsp(3, 'Run For Test DataService.getChildren', \
'''
DataService.getChildren
    MOIData
        setPath    "pyCatalog/"
''', \
'''
List
    0
        MOIData
            getPath    "pyCatalog/schema0"
            getId    "Schema=1"
            getName    "schema0"
    1
        MOIData
            getPath    "pyCatalog/schema1"
            getId    "Schema=2"
            getName    "schema1"
    2
        MOIData
            getPath    "pyCatalog/schema2"
            getId    "Schema=3"
            getName    "schema2"
'''
)
        print rsp_msg
        rsp_msg = test.requestAndRsp(4, 'Run For Test DataService.getChildren', \
'''
DataService.getChildren
    String    "Catalog=1"
''', \
'''
List
    0
        MOIData
            getId    "Schema=1"
            getName    "schema0"
    1
        MOIData
            getId    "Schema=2"
            getName    "schema1"
    2
        MOIData
            getId    "Schema=3"
            getName    "schema2"
'''
)
        print rsp_msg
        rsp_msg = test.requestAndRsp(5, 'Run For Test DataService.getChildren', \
'''
DataService.getChildren
    String    "Catalog=1"
    int    1
    int    2
''', \
'''
List
    0
        MOIData
            getId    "Schema=1"
            getName    "schema0"
    1
        MOIData
            getId    "Schema=2"
            getName    "schema1"
    2
        MOIData
            getId    "Schema=3"
            getName    "schema2"
'''
)
        print rsp_msg
        rsp_msg = test.requestAndRsp(6, 'Run For Test DataService.getChildren', \
'''
DataService.getChildren
    String    "Catalog=1"
    MOIRelationType
        setId    "RelationShipType=3"
''', \
'''
List
    0
        MOIData
            getId    "Schema=1"
            getName    "schema0"
    1
        MOIData
            getId    "Schema=2"
            getName    "schema1"
    2
        MOIData
            getId    "Schema=3"
            getName    "schema2"
'''
)
        print rsp_msg
        print '\nDone'
        test.quit()
        
    def testGetChildrenCount(self):
        test = testTools(__file__) 
        rsp_msg = test.requestAndRsp(7, 'Run For Test DataService.getChildrenCount', \
'''
DataService.getChildrenCount
    String    "Schema=2"
''', \
'''
5
'''
)
        print rsp_msg
        print '\nDone'
        test.quit()
        
    def testGetData(self):
        test = testTools(__file__)
        rsp_msg = test.requestAndRsp(8, 'Run For Test DataService.getData', \
'''
DataService.getData
    String    "Schema=3"
''', \
'''
MOIData
    getId    "Schema=3"
    getName    "schema2"
'''
)
        print rsp_msg
        print '\nDone'
        test.quit()
        
    def testGetDatas(self):
        test = testTools(__file__)
        rsp_msg = test.requestAndRsp(9, 'Run For Test DataService.getDatas', \
'''
DataService.getDatas
    String    "Schema=3"
''', \
'''
MOIData
    getId    "Schema=3"
    getName    "schema2"
'''
)
        print rsp_msg
        print '\nDone'
        test.quit()
        
def testGetDatasCount(self):
        test = testTools(__file__)
        rsp_msg = test.requestAndRsp(10, 'Run For Test DataService.getDatasCount', \
'''
DataService.getDatasCount
    String    "Schema=3"
''', \
'''
MOIData
    getId    "Schema=3"
    getName    "schema2"
'''
)
        print rsp_msg
        print '\nDone'
        test.quit()
        
def testGetParent(self):
        test = testTools(__file__)
        rsp_msg = test.requestAndRsp(20, 'Run For Test DataService.getParent', \
'''
DataService.getParent
    String    "Schema=3"
''', \
'''
MOIData
    getId    "Schema=3"
    getName    "schema2"
'''
)
        print rsp_msg
        print '\nDone'
        test.quit()
        
def testGetPath(self):
        test = testTools(__file__)
        rsp_msg = test.requestAndRsp(30, 'Run For Test DataService.getPath', \
'''
DataService.getPath
    String    "Schema=3"
''', \
'''
MOIData
    getId    "Schema=3"
    getName    "schema2"
'''
)
        print rsp_msg
        print '\nDone'
        test.quit()
        
def testGetPathes(self):
        test = testTools(__file__)
        rsp_msg = test.requestAndRsp(40, 'Run For Test DataService.getPathes', \
'''
DataService.getPathes
    String    "Schema=3"
''', \
'''
MOIData
    getId    "Schema=3"
    getName    "schema2"
'''
)
        print rsp_msg
        print '\nDone'
        test.quit()

def testGetRootNodes(self):
        test = testTools(__file__)
        rsp_msg = test.requestAndRsp(50, 'Run For Test DataService.getRootNodes', \
'''
DataService.getRootNodes
    String    "Schema=3"
''', \
'''
MOIData
    getId    "Schema=3"
    getName    "schema2"
'''
)
        print rsp_msg
        print '\nDone'
        test.quit()
        
def testGetRoots(self):
        test = testTools(__file__)
        rsp_msg = test.requestAndRsp(60, 'Run For Test DataService.getRoots', \
'''
DataService.getRoots
    String    "Schema=3"
''', \
'''
MOIData
    getId    "Schema=3"
    getName    "schema2"
'''
)
        print rsp_msg
        print '\nDone'
        test.quit()

if __name__ == "__main__":
    unittest.main()

